Views
A View represents everything that is visible at a given time in Infinite Table.
Each View can include a large number of different elements including:
- visible columns
 - Calculated Columns
 - current row grouping, sorting, pivoting and aggregations
 - Filtering - both Column Filters and the Grid Filter
 - Styled Cells
 - Flashing Cells
 
Configuring Views
Views are configured via the view property in the default State.
Caution
This property is mandatory - Developers must always provide at least one view in the state
defaultState = {
  // configure Views here
  view: {
    currentViewId: 'myView',
    views: [
      {
        id: 'myView',
        label: 'My View',
        columns: [
          {
            id: 'full_name',
          },
          {
            id: 'description',
          },
        ],
      },
    ],
  },
};Note
- Each 
viewneeds to have anidproperty (this property is referenced instate.view.currentViewIdto make it the activeview) - Additionally, views can also have a 
labelproperty, which is a human readable name for theview - If no 
labelis provided, theidproperty value will be used as the view label. 
Active View
At any given time, there will be an active View, which is configured via state.view.currentViewId.
Types of Views
AdapTable provides 2 types of Views:
- 
Table Views - show columns in standard tabular format (with row grouping if required)
 - 
Pivot Views - display data in pivoted, aggregated format
 
Each view is either a Table View or a Pivot View.
Note
Once defined or created, a Table View cannot be changed to be a Pivot View (or vice versa)
Columns
The most important element of a view is the columns property.
Configuring columns
Each column is an object which references one of the columns made available to the component via state.globalEntities.availableColumns.
import { type AdaptableColDef } from '@adaptabletools/adaptable-infinite-react';
// This example will show a table of JavaScript Web frameworks
const availableColumns: Record<string, AdaptableColDef> = {
  id: { field: 'id', dataType: 'number' },
  name: { field: 'name', label: 'Name', dataType: 'text' },
  language: { field: 'language', dataType: 'text' },
  license: { field: 'license', dataType: 'text' },
  stars: {
    field: 'github_stars', editable: true, dataType: 'number'
  },
  '2xstars': { expression: '[stars] * 2', dataType: 'number' }
};
<Adaptable.Provider
  primaryKey="id"
  adaptableId="Adaptable View Demo"
  data={[...]}
  defaultState={{
    view: {
      currentViewId: 'tableView',
      views: [
        {
          id: 'tableView', label: 'Table View',
          columns: [
            { id: 'name' }, // reference the `name` column
            { id: 'stars', editable: false },
            { id: 'language' },
          ],
        }
      ]
    },
    globalEntities: {
      availableColumns,
    },
  }}
>
</Adaptable.Provider>Defining available columns
The state contains some global objects (or entities, as we call them) that are made available to all views so they can be used everywhere. Columns are such an entity and they need to be mentioned in state.globalEntities.availableColumns before being referenced in views.
The state.globalEntities.availableColumns is an object keyed by the column id and the values are column definitions.
Let's take an example:
import { type AdaptableColDef } from '@adaptabletools/adaptable-infinite-react';
const availableColumns: Record<string, AdaptableColDef> = {
  name: { field: 'name', label: 'Name', dataType: 'text' },
  language: { field: 'language', dataType: 'text' },
  license: { field: 'license', dataType: 'text' },
  stars: {
    field: 'github_stars',
    editable: true,
    dataType: 'number',
  },
  '2xstars': { expression: '[stars] * 2', dataType: 'number' },
};The columns here are not listed in any specific order, since this is the definition of the columns - the column visibility and order will be defined in a view.
There are two major types of columns:
- value columns - which have their 
fieldbound to a property in the data object or have avalueGetterfunction defined - calculated columns - which have their 
expressionproperty configured 
Note
Calculated columns are columns which have their value computed using an AdaptableQL expression. The expression allows you to reference existing columns and perform operations (eg: [stars] * 2).
Please note that the [colId] notation references column ids, not data fields from the data rows.
Deep Dive
Read about Column Properties
Using column references in view.columns
After the columns have been declared in state.globalEntities.availableColumns, they can be referenced in views.
defaultState = {
  view: {
    currentViewId: 'myView',
    views: [
      {
        id: 'myView',
        label: 'My View',
        columns: [
          { id: 'name' },
          { id: 'language' },
          { id: 'license' },
          { id: 'id', visible: false },
          { id: 'stars', editable: false },
        ],
      },
    ],
  },
};The only mandatory property in a column reference inside a view is the id - which points back to the respective column in state.globalEntities.availableColumns.
When referencing a column, you can override all of the non-mandatory properties from the column definition.
Using row grouping in views
A table view can be configured to have row grouping and the grouping can be added/removed/edited at runtime by end-users (if the permissions are configured to allow it, which is the default).
defaultState = {
  view: {
    currentViewId: 'firstView',
    views: [
      {
        id: 'firstView',
        label: 'My View',
        columns: [
          { id: 'group-by-language', groupBy: 'language'}
          { id: 'group-by-license', groupBy: 'license'}
          { id: 'name', },
          { id: 'license' },
          { id: 'stars', editable: false }
        ],
      },
    ],
  },
};Note
The id of the group column doesn't need to reference an existing column definition - but make sure it's still unique in the view.
Besides that, a group column is defined like any other column in the view, but it has the groupBy property configured.
The column groupBy can be either a string or a string[] (the value(s) in the groupBy needs to reference an existing column in the state.globalEntities.availableColumns ).
- if the 
groupByis astring, the group column will render the grouping values for that column (you can have more than one group column withgroupByset to astring). - if the 
groupByis astring[], the group column will render the grouping values for all the specified columns (you can only have one group column withgroupByset to astring[]). 
defaultState = {
  view: {
    currentViewId: 'firstView',
    views: [
      {
        id: 'firstView',
        label: 'My View',
        columns: [
          { id: 'group', groupBy: ['language','license'] }
          { id: 'name', },
          { id: 'license' },
          { id: 'stars', editable: false }
        ],
      },
    ],
  },
};